﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using System.Data.SqlClient;
using System.Configuration;
using Delonix_Regia_Hotel.Class;
using DelonixRegia__Staff_Use_.Classes;


namespace DelonixRegia__Staff_Use_
{
    public partial class StaffUpdate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Label8.Text = Request.QueryString["name"];
            Label12.Text = Request.QueryString["name"];
            if (Label8.Text == "Admin")
            {
                Label10.Visible = true;
                LinkButton5.Visible = true;
                Label9.Visible = true;
                LinkButton4.Visible = true;
            }
        }

        protected void LinkButton3_Click(object sender, EventArgs e)
        {
            Response.Redirect("StaffUpdate.aspx?name=" + Label8.Text);
        }

        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            Response.Redirect("StaffWorkTime.aspx?name=" + Label8.Text);
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Response.Redirect("Particulars.aspx?name=" + Label8.Text);
        }

        protected void LinkButton4_Click(object sender, EventArgs e)
        {
            Response.Redirect("CreateStaffAccount.aspx?name=" + Label8.Text);
        }

        

        protected void LinkButton6_Click(object sender, EventArgs e)
        {
            Response.Redirect("CancelBooking.aspx?name=" + Label8.Text);
        }

        protected void LinkButton5_Click(object sender, EventArgs e)
        {
            Response.Redirect("DeleteStaff.aspx?name=" + Label8.Text);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Staff u = new Staff();
            u.Address = tbxaddress.Text;
            u.Age = tbxage.Text;
            u.Contact = tbxcontact.Text;
            u.Dob = tbxdob.Text;
            u.Email = tbxemail.Text;
            u.Ic = tbxic.Text;
            u.Name = Label12.Text;
            u.Staffid = tbxid.Text;
            if (Staff.UpdateStaff(u) == 1)
            {
                lblOutput.Text = "Successfully Updated!";
                lblOutput.Visible = true;
            }
            else
            {
                lblOutput.Text = "Failed to update!";
                lblOutput.Visible = true;
            }
        }

        protected void TextBox2_TextChanged(object sender, EventArgs e)
        {

        }

        protected void TextBox2_TextChanged1(object sender, EventArgs e)
        {

        }

        protected void tbxcontact_TextChanged(object sender, EventArgs e)
        {

        }
    }
}